(define (search-for-primes x)
  (define (timed-prime-test n)
    (newline)
    (display n)
    (start-prime-test n (real-time-clock)))
  (define (start-prime-test n start-time)
    (if (fast-prime? n 100) 
      (report-prime (- (real-time-clock) start-time))))
  (define (report-prime elapsed-time)
    (display " *** ")
    (display elapsed-time))
  (define (expmod base exp m)
    (cond ((= exp 0) 1)
          ((even? exp) (remainder (square (expmod base (/ exp 2) m)) m))
          (else (remainder (* base (expmod base (- exp 1) m)) m))))
  (define (fermat-test n)
    (define (try-it a)
      (= (expmod a n n) a))
    (try-it (+ 1 (random (- n 1)))))
  (define (fast-prime? n times)
    (cond ((= times 0) #t) 
          ((fermat-test n) (fast-prime? n (- times 1)))
          (else #f)))
  (timed-prime-test x))
